#define _CRT_SECURE_NO_WARNINGS 1
#pragma warning(disable:4996)
#include<stdio.h>
int SearchPos(int* nums, int numsLen,float n) {
    int left = 0, right = numsLen - 1;
    while (left <= right) {
        int mid = left + (right - left) / 2;
        if (nums[mid] > n) {
            right = mid - 1;
        }
        if (nums[mid] < n) {
            left = mid + 1;
        }
        return left;
    }
}
int GetNumberOfK(int* nums, int numsLen, int k) {
    // write code here
    return SearchPos(nums, numsLen, k +0.5) - SearchPos(nums, numsLen, k - 0.5);

}
int main(){
    int arr[5] = { 1,2,2,2,3 };
    int k=GetNumberOfK(arr, 5, 2);
    printf("%d", k);
    return 0;
}
